package model.bean;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name="t_item_menu")
public class ItemMenu {

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "geradorItemMenu")
	@SequenceGenerator(name = "geradorItemMenu", sequenceName = "sequence_item_menu", allocationSize=1)
	@Column(name="id_item_menu")
	private Long id;
	
	@Column(name="nome_item_menu",length=40)
	private String nomeItemMenu;
	
	@Column(name="nome_metodo_item",length=40)
	private String nomeMetodoItem;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name="id_menu",insertable=true, updatable=true)
	@Fetch(FetchMode.SELECT)
	@Cascade(CascadeType.SAVE_UPDATE)
	private Menu menu;
	
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	public String getNomeItemMenu() {
		return nomeItemMenu;
	}
	
	public void setNomeItemMenu(String nomeItemMenu) {
		this.nomeItemMenu = nomeItemMenu;
	}

	public Menu getMenu() {
		return menu;
	}

	public void setMenu(Menu menu) {
		this.menu = menu;
	}

	public String getNomeMetodoItem() {
		return nomeMetodoItem;
	}

	public void setNomeMetodoItem(String nomeMetodoItem) {
		this.nomeMetodoItem = nomeMetodoItem;
	}
	
	
}
